package com.ja.openchat.views;

import android.graphics.Typeface;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ja.openchat.R;

import java.util.List;

public class ChooseListAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private int mChoosePosition = 0;
    public ChooseListAdapter(@Nullable List<String> data,int choosePosition) {
        super(R.layout.item_choose_list, data);
        mChoosePosition = choosePosition;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, String s) {
        helper.setText(R.id.content_text,s);
        helper.setTextColor(R.id.content_text, ContextCompat.getColor(getContext(),helper.getAdapterPosition() == mChoosePosition?R.color.login_btn_bg_color:R.color.color_text));
        TextView content_text = helper.getView(R.id.content_text);
        content_text.setTypeface(helper.getAdapterPosition() == mChoosePosition? Typeface.DEFAULT_BOLD:Typeface.DEFAULT);
        helper.setGone(R.id.bottom_line,helper.getAdapterPosition() == getDefItemCount()-1);
    }
}
